package com.lz.ovuola.util.spring.template;

import java.net.URI;
import java.net.URISyntaxException;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

//@Order(value = Integer.MAX_VALUE)
@Component
public class CustomRestTemplate {

	private final RestTemplate restTemplate;

	public CustomRestTemplate(RestTemplateBuilder restTemplateBuilder) {
		this.restTemplate = restTemplateBuilder.build();
	}

	public void someRestCall(String name) throws RestClientException,
			URISyntaxException {
		System.out.println("https---------"
				+ restTemplate.getForObject(
						new URI("https://127.0.0.1:8443/hi"), String.class));
		// 异步template
	}

	public RestTemplate getRestTemplate() {
		return restTemplate;
	}

}
